<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>login</title>
    <link rel="stylesheet" href="/css/bootstrap.min.css" />
    <link href="/css/loginstyle.css" rel="stylesheet">
    <script src="/js/jquery.min.js"></script>
</head>
<body>
<div class="container-fluid tow">
    <div class="row">
        <div class="col-md-6">
            <form th:action="@{/auth/login}" method="post" class="formstyle">
                <h2>用户登录</h2>
                <div class="form-group">
                    <label>电话号码：</label>
                    <input class="form-control" type="text" name="phone" placeholder="请输入您的手机号"><br />
                </div>
                <div class="form-group">
                    <label>密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码：</label>
                    <input class="form-control" type="password" name="password" placeholder="请输入您的密码"><br />
                </div>
                <div class="form-group d-flex">
                    <label>身&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;份：</label>
                    <div class="form-check">
                        <input class="form-check-input" type="radio" name="role" id="patient" value="patient" checked>
                        <label class="form-check-label" for="patient">患者</label>
                    </div>
                    <div class="form-check">
                        <input class="form-check-input" type="radio" name="role" id="doctor" value="doctor">
                        <label class="form-check-label" for="doctor">医生</label>
                    </div>
                </div>
                <div class="form-group">
                    <a href="/auth/toRegister">没有账号？去注册</a>
                </div>
                <div class="form-group text-center">
                    <input  class="btn btn-primary" type="submit" value="登录">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <input class="btn btn-primary" type="reset" value="重置">
                    <br />
                </div>
            </form>
            <span th:text="${msg}" style="display:none;" id="errorMsg"></span>
        </div>
    </div>
</div>
<script>
    window.onload = function() {
        var errorMessage = document.getElementById('errorMsg').textContent;
        if (errorMessage) {
            alert(errorMessage);
        }
    };
</script>
</body>
</html>